#include "myhead.h"

int main()
{
	//申请两个信号量(办两张卡)
	int semid=semget(7545,2,IPC_CREAT|IPC_EXCL|0777);
	if(semid==-1)
	{
		if(errno ==  EEXIST)
			semid=semget(7545,2,0777);
		else
		{
			perror("失败");
			return -1;
		}
	}
	
	//打印两个信号的默认值
	printf("第一个信号量:%d\n",semctl(semid,0,GETVAL));
	printf("第二个信号量:%d\n",semctl(semid,1,GETVAL));
	
}